package goover.unit04;

import java.io.*;

public class BufferedInputStreamDemo01 {
    public static void main(String[] args){
        BufferedInputStream bis = null;
        BufferedOutputStream bos = null;
        try{
            bis = new BufferedInputStream(new FileInputStream("D:\\JAVA\\source\\src.jpg"));
            bos = new BufferedOutputStream(new FileOutputStream("D:\\JAVA\\target\\src.jpg"));
            int len = 0;
            while ((len = bis.read()) != -1){
                bos.write(len);
                bos.flush();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                if(bis != null){
                    bis.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                if(bos != null){
                    bos.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
